/*
 * Copyright© 2003-2019 浙江汇信科技有限公司, All Rights Reserved.
 */
package com.icinfo.cloud.provider.punish.config.controller;

import com.icinfo.cloud.provider.common.constant.Constant;
import com.icinfo.cloud.provider.punish.config.dto.ConfigPaymentChannelInfoQueryDto;
import com.icinfo.cloud.provider.punish.config.service.IConfigPaymentChannelInfoService;
import com.icinfo.cloud.provider.punish.config.vo.ConfigPaymentChannelInfoVo;
import com.icinfo.framework.common.web.Result;
import com.icinfo.framework.core.web.BaseController;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * 描述: 缴费渠道信息配置表 config_payment_channel_info 对应的Controller类.<br>
 *
 * @author framework generator
 * @date 2022年03月01日
 */
@RestController
@RefreshScope
@RequestMapping("/punish/config/payment/channel")
@Slf4j
public class ConfigPaymentChannelInfoController extends BaseController {
    @Resource
    private IConfigPaymentChannelInfoService configPaymentChannelInfoService;

    /**
     * 【V1.0.0】描述：同步缴费渠道配置信息
     *
     * @return {@link Result<String>} 同步结果
     * @author xiangyuyu
     * @date 2022-03-15 16:13
     */
    @PostMapping("/synchronizePaymentChannelConfigInfo")
    @ApiOperation(value = "【V1.0.0】描述：同步缴费渠道配置信息", httpMethod = "POST")
    public Result<String> synchronizePaymentChannelConfigInfo() {
       return configPaymentChannelInfoService.synchronizePaymentChannelConfigInfo();
    }

    /**
     * 【V1.0.0】描述：同步缴费渠道配置信息-同步区域编码信息
     *
     * @return {@link Result<String>} 同步结果
     * @author xiangyuyu
     * @date 2022-03-15 16:13
     */
    @PostMapping("/synchronizePaymentChannelConfigInfoRegiInfo")
    @ApiOperation(value = "【V1.0.0】描述：同步缴费渠道配置信息-同步区域编码信息", httpMethod = "POST")
    public Result<String> synchronizePaymentChannelConfigInfoRegiInfo() {
        return configPaymentChannelInfoService.synchronizePaymentChannelConfigInfoRegiInfo();
    }


    /**
     * 【V1.0.0】描述：查询缴款渠道配置信息
     *
     * @param queryDto {@link ConfigPaymentChannelInfoQueryDto}
     * @return {@link Result<List<ConfigPaymentChannelInfoVo>>} 缴款渠道配置信息
     * @author xiangyuyu
     * @date 2022-03-01 16:51
     */
    @PostMapping("/getPaymentChannelConfigInfo")
    @ApiOperation(value = "【V1.0.0】描述：查询缴款渠道配置信息", httpMethod = "POST")
    public Result<List<ConfigPaymentChannelInfoVo>> getPaymentChannelConfigInfo(@RequestBody @Validated ConfigPaymentChannelInfoQueryDto queryDto) {
        List<ConfigPaymentChannelInfoVo> list = configPaymentChannelInfoService.getPaymentChannelConfigInfo(queryDto);
        return Result.success(Constant.STRING_GET_SUCCESS, list);
    }

    /**
     * 【V2.0.0】描述：根据机构编码查询机构缴款配置信息
     *
     * @param orgCode 机构编码
     * @return {@link Result<ConfigPaymentChannelInfoVo>} 缴款渠道配置信息
     * @author xiangyuyu
     * @date 2022-05-19 14:47
     */
    @PostMapping("/getPaymentChannelConfigInfoByOrgCode")
    @ApiOperation(value = "【V2.0.0】描述：根据机构编码查询机构缴款配置信息", httpMethod = "POST")
    public Result<ConfigPaymentChannelInfoVo> getPaymentChannelConfigInfoByOrgCode(@RequestParam(value = "orgCode") String orgCode,@RequestParam(value = "deptCode") String deptCode) {
        ConfigPaymentChannelInfoVo vo = configPaymentChannelInfoService.getPaymentChannelConfigInfoByOrgCode(orgCode,deptCode);
        return Result.success(Constant.STRING_GET_SUCCESS, vo);
    }
}